#ifndef DYN_STA_H
#define DYN_STA_H

#include <armadillo>
#include "dyn_roots.h"
#include "../utilities/dyn_functor_maps1d.h"

using namespace arma;

/*! \brief This class defines the Stability Transform Algorithm.
 *
 * This algorithm takes a Maps1D, transforms
 * it according to the ST and iterates it to convergence on
 * a fixed point.
 */

class STA : public RootFinding
{
public:
    /*! The constructor defines the parameters of
     * STA.
     */
    STA(Maps1D& map,
        double init,
        double para,
        const double tol,
        const int Nmax);

    /*! @name Accessor functions.
     * We define the accessor functions for this class.
     */
    //@{
    Maps1D& getMaps1D(){return map1d;}
    double getLambda(){return lambda;}
    arma::colvec getFixedPoints(){return fixedPoints;}

    void setMaps1D(Maps1D& map){map1d = map;}
    void setLambda(double para){lambda = para;}
    //@}

    /*! @name Solving functions.
     * Although this class derives from
     * RootFinding, it is not a simple
     * root-finding algorithm.
     * As such, the behaviour of the member
     * functions will be somewhat different.
     * We reimplement the solve() pure virtual.*/
    //@{
    int solve();
    //@}

protected:
    /*! @name STA Parameters.
     * Parameters and variables used
     * in the ST algorithm.
     */
    //@{
    Maps1D& map1d;
    double lambda;
    arma::colvec fixedPoints;
    //@}

};

#endif // DYN_STA_H
